﻿@model IEnumerable<LanDBom.Models.buty2>

@{
    ViewBag.Title = "Index";
    Layout = "~/Views/Shared/_Genertals.cshtml";
}

<h2>物料分类与ERP物料分类对照表</h2>

<h6><input type="submit" name="ERP" id="ERPjisn" value="获取物料对应ERP编码" /></h6>
@*<p>
        @Html.ActionLink("Create New", "Create")
    </p>*@
<table class="table">
    <tr>
        <th>
            @Html.Label("一级分类")
        </th>
        <th>
            @Html.Label("二级分类")
        </th>
        <th>
            @Html.Label("ERP成品物料分类")
        </th>
        <th>
            @Html.Label("ERP半成品物料分类")
        </th>
        <th>操作</th>
    </tr>

    @foreach (var item in Model)
    {
        <tr>
            <td>
                @Html.DisplayFor(modelItem => item.buty3.zl2_name)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.zl_name)
            </td>

            <td>
                @Html.DisplayFor(modelItem => item.ERP_Bm)
            </td>
            <td>
                @Html.DisplayFor(modelItem => item.ERP_id)
            </td>
            <td>
                @Html.ActionLink("修改", "Edit", new { id = item.zl_id })@* |
                    @Html.ActionLink("Details", "Details", new { id = item.zl_id }) |
                    @Html.ActionLink("删除", "Delete", new { id = item.zl_id })*@
            </td>
        </tr>
    }
</table>
@section scripts{
    <script src="~/Scripts/jquery-3.4.1.min.js"></script>
    <script src="~/Scripts/bootstrap.min.js"></script>
    <script>
        $(function () {
            $(document).on("click", "#ERPjisn", function () {
                if (confirm("是否同步")) {
                    $.ajax({
                        url: "/buty2/Xiugai",
                        type: "POST",
                        data: { "state": 1 },
                        success: function (text) {
                            alert(text)
                            
                        },
                        error: function (text) {
                            alert("系统错误" + text);
                        }
                    })
                }
            })
        })
    </script>
}